package com.ruoyi.system.mapper;

import com.ruoyi.system.domain.SysClient;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * ClassName: ClientMapper <br/>
 * Description: <br/>
 * date: 2020/3/26 9:46<br/>
 *
 * @author Hesion<br />
 * @since JDK 1.8
 */
@Mapper
public interface ClientMapper {
    @Select("SELECT * FROM sys_client  where del_flag = '0'")
    @Results(id = "SysClientManageResult",
            value = {
                    @Result(property = "createTime", column = "create_time"),
                    @Result(property = "updateTime", column = "update_time"),
                    @Result(property = "updateBy", column = "update_by"),
                    @Result(property = "createBy", column = "create_by"),
            })
    List<SysClient> selectClientByPage(SysClient sysClient);

    @Delete("DELETE FROM sys_client WHERE id =#{id}")
    Integer remove(String id);

    @Insert("INSERT INTO sys_client(`name`,sex,telphone,address,create_time,create_by,update_time,update_by,del_flag) VALUES(#{name},#{sex},#{telphone},#{address},#{createTime},#{createBy},#{updateTime},#{updateBy},#{del_flag})")
    Integer add(SysClient sysClient);

    @Select("SELECT * FROM sys_client WHERE id=#{id}")
    SysClient selectClientById(String id);

    @Update("UPDATE sys_client SET `name`=#{name},sex=#{sex},`address`=#{address},telphone=#{telphone},update_by=#{updateBy},update_time=#{updateTime} WHERE id=#{id}")
    Integer edit(SysClient sysClient);
}
